package cn.studyjava.docker;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @ClassName: StartApp
 * @Description: TODO
 * @author: zsljava
 * @date: 2020年2月19日 下午2:19:45
 */
@SpringBootApplication
@RestController
public class StartApp {
    public static void main(String[] args) {
        SpringApplication.run(StartApp.class, args);
    }

    @RequestMapping("/")
    public String index() {
        return "hello spring boot, 现在时间为： " + formatDate(new Date());
    }
    
    @RequestMapping("/say")
    public String say(String say) {
        return "you say: " + say;
    }
    
    @RequestMapping("/send")
    public String send(String say) {
    	return "you send: " + say;
    }
    
    private String formatDate(Date date){
    	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    	String format = sdf.format(date);
    	return format;
    }

}
